﻿using System;
using System.Windows.Forms;

namespace CaloriesCalculator
{
    public partial class CaloriesCalculator : Form
    {
        public CaloriesCalculator()
        {
            InitializeComponent();
        }

        private void btnCalculate_Click(object sender, EventArgs e)
        {
            if (rbtnMale.Checked)
            {
                txtCalories.Text = (66M
                            + (6.3M * Convert.ToDecimal(txtWeight.Text))
                            + (12.9M * ((Convert.ToDecimal(txtFeet.Text) * 12M)
                            + Convert.ToDecimal(txtInches.Text)))
                            - (6.8M * Convert.ToDecimal(txtAge.Text))).ToString();
            }
            else
            {
                txtCalories.Text = (655M
                            + (4.3M * Convert.ToDecimal(txtWeight.Text))
                            + (4.7M * ((Convert.ToDecimal(txtFeet.Text) * 12M)
                            + Convert.ToDecimal(txtInches.Text)))
                            - (4.7M * Convert.ToDecimal(txtAge.Text))).ToString();
            }
        }
    }
}
